<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    //系统平台uid
    const PLATFORM_UID = 1;

    protected $fillable = [
        'uid',
        'name',
        'avatar',
        'device_type',
    ];

    public function publisher()
    {
        return $this->hasOne(Publisher::class);
    }

    /**
     * 是否发布者
     *
     * @return bool
     */
    public function isPublisher()
    {
        return $this->publisher && $this->publisher->isValid();
    }
}
